home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Workspace / Locus / Source / WidePopupController.m < prev   
Text File  |  1995-06-12  |  2KB  |  147 lines

  1.  
  2. /*
  3.     Copyright 1993  Jeremy Slade.
  4.  
  5.     You are free to use all or any parts of the Locus project
  6.     however you wish, just give credit where credit is due.
  7.     The author (Jeremy Slade) shall not be held responsible
  8.     for any damages that result out of use or misuse of any
  9.     part of this project.
  10.  
  11. */
  12.  
  13. /*
  14.     Project: Locus
  15.     
  16.     Class: WidePopupController
  17.     
  18.     Description: See WidePopupController.h
  19.  
  20.     Original author: Jeremy Slade
  21.     
  22.     Revision History:
  23.         Created
  24.             V.101    JGS FMon Feb  8 23:00:40 GMT-0700 1993
  25.  
  26. */
  27.  
  28. #import "WidePopupController.h"
  29.  
  30. #import <appkit/appkit.h>
  31.  
  32.  
  33. @implementation WidePopupController
  34.  
  35.  
  36. + initialize
  37. /*
  38.     set the class version number
  39. */
  40. {
  41.     [self setVersion:WidePopupController_VERSION];
  42.     return ( self );
  43. }
  44.  
  45.  
  46.  
  47. - initForButton:aButton andPopup:aPopUpList
  48. /*
  49.     Connects self as the intermediary between aButton and aPopUpList.  aButton sends self the popUp: message, which is forwarded to aPopUpList
  50. */
  51. {
  52.     [super init];
  53.     
  54.     cover = aButton;
  55.     popUp = aPopUpList;
  56.     
  57.     [popUp sizeToFit];
  58.     [[cover setTarget:self] setAction:@selector(popUp:)];
  59.     
  60.     return ( self );
  61. }
  62.  
  63.  
  64.  
  65. - getBounds:(NXRect *)rect
  66. /*
  67.     Determine the bound rect of the PopUpList.  Uses the frame of the button or the popUpList, whichever is wider ( make sure it is wide enough to display the whole thing, but not any shorter than the button is )
  68. */
  69. {
  70.     NXRect popupFrame;
  71.     
  72.     [popUp getFrame:&popupFrame];
  73.     [cover getBounds:rect];
  74.  
  75.     if ( NX_WIDTH(rect) < NX_WIDTH(&popupFrame)-1 )
  76.         rect->size.width = NX_WIDTH(&popupFrame)-1;
  77.     
  78.     return ( self );
  79. }
  80.  
  81.  
  82.  
  83. - setTitle:(const char *)aString
  84. /*
  85.     Receives messages from the popUp list directed for the cover.  The object that sends the popUp: mesasge to the popUp must respond to this message in return.
  86. */
  87. {
  88.     [cover setTitle:aString];
  89.     
  90.     return ( self );
  91. }
  92.  
  93.  
  94.  
  95. - convertPoint:(NXPoint *)aPoint toView:aView
  96. /*
  97.     Forward to the cover -- this would normally be sent directly to the cover button from the popUp.
  98. */
  99. {
  100.     [cover convertPoint:aPoint toView:aView];
  101.     
  102.     return ( self );
  103. }
  104.  
  105.  
  106.  
  107. - popUp:sender
  108. /*
  109.     Send the popUp: message to the popUp
  110. */
  111. {
  112.     [popUp sizeToFit];
  113.     return ( [popUp popUp:self] );
  114. }
  115.  
  116.  
  117.  
  118. - window
  119. {
  120.     return ( [cover window] );
  121. }
  122.  
  123.  
  124.  
  125. - display
  126. {
  127.     return ( [cover display] );
  128. }
  129.  
  130.  
  131.  
  132. - (BOOL)needsDisplay
  133. {
  134.     return ( [cover needsDisplay] );
  135. }
  136.  
  137.  
  138.  
  139. - (const char *)title
  140. {
  141.     return ( [cover title] );
  142. }
  143.  
  144.  
  145.  
  146. @end
  147.